



fn main() {
    // 1. 字符串slice是String中一部分值的引用
    let s = String::from("hello world");

    let h = &s[0..5];

    println!("h = {}",h);

    // 2. 字面值就是slice
    let ha = "hahaha";

    println!("ha = {}",ha);


    // 3. 其他类型slice
    let str = [1,2,3,4];

    let sr = &str[1..3];

    println!("sr[0] = {}",sr[0]);

    println!("Hello, world!");

}
